<template>
  <div>
    <DaoHang1Vue :messageData="messageData" :identityChangeData="identityChangeData" :username="username"></DaoHang1Vue>
    <DropDownListVue :ListData="ListData"></DropDownListVue>
    <InfoBoxVue ></InfoBoxVue>
    
  </div>
</template>

<script>
import axios from 'axios'
import DaoHang1Vue from './components/DaoHang1.vue'
import DropDownListVue from './components/DropDownList.vue'
import InfoBoxVue from './components/InfoBox.vue'


export default {
    data(){
      return{
          username: '',
          identity: '',
          //后续添加菜单栏在这里按照格式加
          ListData:[
            {
              title:'信息查询',
              children: [
                {
                title: '老师信息',
                location: '/#/Admin/teacherInfo',
                },
                {
                  title:'学生信息',
                  location: '/#/Admin/studentInfo',
                },
                {
                  title: '选题信息',
                  location : '/#/Admin/bisheInfo',
                }
                ],
              },
              {
                title: '审核',
                children: [
                  {
                    title: '审核通过',
                    location: '/#/Admin/AdminCheckPassed/passed',
                  },
                  {
                    title: '待审核',
                    location: '/#/Admin/AdminCheckWaitPass/wait_pass',
                  },
                  {
                    title: '打回的审核',
                    location: '/#/Admin/AdminCheckPushBack/push_back',
                  },
                ]
              },
              {
                title: '消息功能',
                children: [
                  {
                    title: '设置毕设选题开放时间',
                    location: '/#/Admin/setOpenTime',
                  },
                  {
                    title: '发送消息提醒',
                    location: '/#/Admin/SendMessage',
                  },
                  
              ]
            },
            {
                title: '账户管理',
                children: [
                  {
                    title: '新增用户',
                    location: '/#/register',
                  },
                  
                  
              ]
            },
          ],
            

              //根据身份不同变化的数据
              identityChangeData:[
                {
                  skillName: '个人中心',
                  location: ``
                },
                {
                  skillName: '退出登录',
                  location: '/#/'
                }
              ],
            
      }
    },

    components: {
      DropDownListVue,
      DaoHang1Vue,
      InfoBoxVue,
    },
    created(){
      this.username = this.$route.query.username
      this.identity = this.$route.query.identity
      this.identityChangeData.forEach(e =>{
        if(e.skillName === '个人中心')
          e.location = `/#/${this.identity}/personalInfo?username=${this.username}`
      })
      // axios.post('用户信息提交位置',{
      //           username:this.username,
      //           }).then(response => {//TODO
      //               console.log("数据发送成功：",response.data)
      //               this.messageData = response.data
      //           }).catch(error => {
      //               this.$router.push({name:'error', params:{error:error}})
      //           })
      
     
    },
    methods:{
      initData(){
        axios.get("地址")
        .then(response => {
          this.title = response.data.title;
          this.content = response.data.content;
        })
        .catch(error => {
          console.error('Error fetching data:', error);
        });
      }

    }
}
</script>

<style>

</style>